﻿using Architecture.Domain.Service;
using Architeture.Domain;
using MediatR;
using RBAC.ZhuBoLin.Application.Command.RoleCommand.Goods;
using System;
using System.Net;

namespace RBAC.ZhuBoLin.Application.CommandHandlers.RoleHandler.Goods
{
    public class EnterAddOneCommandHandler : IRequestHandler<EnterAddOneCommand, int>
    {
        protected readonly IEnterpriseService service;

        public EnterAddOneCommandHandler(IEnterpriseService service)
        {
            this.service = service;
        }

        public async Task<int> Handle(EnterAddOneCommand request, CancellationToken cancellationToken)
        {
            return await service.EntRlaughterAdd(new EnterpriseInfo() { EnterpriseInfoid = request.EnterpriseInfoid, GoodsInfoid = request.GoodsInfoid, Breedingfarm = request.Breedingfarm, charge = request.charge, Numberofstorage = request.Numberofstorage, Nameofcompany = request.Nameofcompany, Address = request.Address, city = request.city, county = request.county, HaveTime = request.HaveTime, Introduction = request.Introduction, Processingcompany = request.Processingcompany, Productionlicensenumber = request.Productionlicensenumber });
        }
    }
}
